<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-8-4
 * Time: 下午6:56
 */

namespace ActionsHttp;

use Data\Order_form_DAO;
use Data\Order_for_foods_DAO;

class ConsumerOrderInfo extends BaseActionHttp
{
    public function doAction() {
        parent::doAction();
        // 订单id
        $order_form_id = (int)$this->data[ORDER_FORM_ID];
        // 订单记录
        $order_form_record = Order_form_DAO::getRecord($order_form_id);
        if (!$order_form_record) {
            return $this->SendErrMsg("没有此订单记录");
        }

        $_SESSION[CONSUMER_ID] = 1;
        if ($order_form_record->getCREATED_BY() != $_SESSION[CONSUMER_ID]) {
            return $this->SendSessionOut();
        }

        // 订单中商品信息
        $order_for_food_list = Order_for_foods_DAO::getListByOrderFormId($order_form_id);
        // 订单信息
        $order_form_info = $order_form_record->getArray();
        $order_form_info[ORDER_FOR_FOOD_INFO] = $order_for_food_list;

        // 返回数据
        $this->setValue(ORDER_FORM_INFO,$order_form_info);
        $this->ResponseDataToCurrentClient();
    }
}